//
//  MyDecatilView.m
//  庐山通
//
//  Created by zcj on 15-11-4.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "MyDecatilView.h"
#import "HotModel.h"
#import "hotDecalFrame.h"
#import <UIKit/UIKit.h>
#import "Grouble.h"


@interface MyDecatilView()
@property (nonatomic,weak)UIImageView * avatarIcon;// 头像
@property (nonatomic,weak)UILabel * titleName;// 标题
@property (nonatomic,weak)UILabel * posttimeText;// 时间
@property (nonatomic,weak)UIImageView * imgView;// 图片
@property (nonatomic,weak)UILabel * usernameText;// 用户名
@property (nonatomic,weak)UILabel * postitionText;// 位置
@property (nonatomic,weak)UILabel * tidDashang;// 大赏
@end
@implementation MyDecatilView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView * avatarIcon= [[UIImageView alloc]init];
        [self addSubview:avatarIcon];
        self.avatarIcon = avatarIcon;
        
        // 标题
        UILabel *titleName = [[UILabel alloc]init];
        titleName.numberOfLines = 0;
        titleName.font = [UIFont systemFontOfSize:12];
        titleName.textAlignment = NSTextAlignmentLeft;
        titleName.textColor = [UIColor clearColor];
        [self addSubview:titleName];
        self.titleName = titleName;
        // 时间
        UILabel *posttimeText = [[UILabel alloc]init];
        posttimeText.font = [UIFont systemFontOfSize:12];
        posttimeText.numberOfLines = 0;
        
        [self addSubview:posttimeText];
        self.posttimeText = posttimeText;
        // 图片
        UIImageView *imgView = [[UIImageView alloc]init];
        [self addSubview:imgView];
        self.imgView = imgView;
        // 用户名
        UILabel *usernameText = [[UILabel alloc]init];
        usernameText.font = [UIFont systemFontOfSize:15];
        usernameText.numberOfLines  = 0;
        usernameText.textAlignment = NSTextAlignmentLeft;
        [self addSubview:usernameText];
        self.usernameText = usernameText;
        // 位置
        UILabel *postitionText = [[UILabel alloc]init];
        posttimeText.font = [UIFont systemFontOfSize:12];
        posttimeText.textColor = [UIColor clearColor];
        [self addSubview:postitionText];
        self.postitionText = postitionText;
        
        // 大赏
        UILabel *tidDashang = [[UILabel alloc]init];
        posttimeText.font = [UIFont systemFontOfSize:12];
        posttimeText.textColor = [UIColor clearColor];
        [self addSubview:tidDashang];
        self.tidDashang = tidDashang;
    }
    return self;
}
// 设置hotmodel
- (void)setHotModel:(hotDecalFrame *)hotModel
{
    _hotModel  = hotModel;
    HotModel * model = hotModel.hotModel;
    
    [self.avatarIcon setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"new_dot_os7"]];
    self.avatarIcon.frame = hotModel.avatarF;
    
    self.usernameText.text = model.username;
    self.usernameText.frame = hotModel.usernameF;
    
    self.titleName.text = model.title;
    self.titleName.frame = hotModel.titleF;
    
    self.postitionText.text = model.position;
    self.postitionText.frame = hotModel.positionF;
    
}

@end
